Ext.define("Admin.view.emergencyDispatch.NewPlan", {
    extend: "Admin.common.container.WizardContainer",
    xtype: "newPlan",
    alias: "newPlan",
    requires: [
        "Ext.panel.Panel",
        "Ext.grid.Panel",
        "Ext.button.Button",
        'Admin.common.panel.BaseGridPanel',
        "Admin.store.emergencyDispatch.NewPlanEventList",
        "Admin.store.emergencyDispatch.NewPlanEventData",
        "Admin.view.emergencyDispatch.NewPlanViewModel",
        'Admin.store.emergencyDispatch.DdsEdP'
    ],
    controller: "newPlan",
    viewModel: {
        type: "newPlan"
    },
    wizards: ["基本信息", "边界条件", "水库调节", "调度结果", "动画演进"],
    stepWidth: 25,
    method: true,
    height: 200,
    listeners: {
        clickNext: "next",
        activate: function(combo) {
            var _that = this;
            var eventProCdObj = Ext.getCmp("newPlanProCd");

            // var store = Ext.create("Ext.data.Store", {
            //     autoLoad: true,
            //     proxy: {
            //         type: "ajax",
            //         extraParams: {
            //             river: config.RIVER
            //         },
            //         url: config.URL + "emergency/ddsEdP/listDispatch",
            //         reader: {
            //             type: "json",
            //             rootProperty: "list"
            //         }
            //     }
            // });
            var store = Ext.create("Admin.store.emergencyDispatch.DdsEdP");
            store.filter({
                property: "nt",
                value: '2'
            });
            eventProCdObj.setStore(store);

            store.on('endupdate', function() {
                if (!store.getAt(0)) {
                    Ext.toast({
                        html: "没有方案可供选择!",
                        width: 200,
                        align: 't'
                    });
                    return;
                }
                // if (!eventProCdObj.getValue()) {
                var value = config.newPlanProCd ? config.newPlanProCd : store.getAt(0).get('proCd');
                // console.log('value', value);
                eventProCdObj.setValue(value);
                // }
            });
        },
    },
    layout: {
        type: "vbox",
        align: "stretch" //拉伸使其充满整个父容器
    },
    dmitem: {
        xtype: "baseFormPanel",
        columns: 5,
        items: [{
                xtype: "textfield",
                fieldLabel: "方案名称",
                width: 240
            },
            {
                xtype: "textfield",
                fieldLabel: "事件名称",
                width: 240
            },
            {
                xtype: "datetimefield",
                editable: false,
                fieldLabel: "时间",
                width: 200
            }, '--',
            {
                xtype: "datetimefield",
                editable: false,
                width: 200
            },
            {
                xtype: "textfield",
                fieldLabel: "时段类型",
                width: 150
            }
        ]
    },
    cardItems: [{
            xtype: "panel",
            reference: "project",
            border: true,
            title: "新建方案",
            layout: {
                type: "vbox",
                align: "stretch"
            },
            flex: 1,
            items: [{
                    xtype: "panel",
                    height: 250,
                    layout: "column",
                    bodyPadding: "8 8 8 8",
                    defaultType: "textfield",
                    defaults: {
                        margin: "5 10 0 10",
                        columnWidth: 0.33,
                        disabled: true,
                        labelAlign: "right"
                    },
                    items: [{
                            xtype: "combobox",
                            fieldLabel: "方案名称",
                            valueField: "proCd",
                            id: 'newPlanProCd',
                            displayField: "proNm",
                            disabled: false,
                            emptyText: "请选择应急事件",
                            reference: "warnProject",
                            listeners: {
                                // added: function(combo) {
                                // 	var _that = this;
                                // 	var store = Ext.create("Ext.data.Store", {
                                // 		autoLoad: true,
                                // 		proxy: {
                                // 			type: "ajax",
                                // 			extraParams: {
                                // 				river: config.RIVER
                                // 			},
                                // 			url: config.URL + "emergency/ddsEdP/listDispatch",
                                // 			reader: {
                                // 				type: "json",
                                // 				rootProperty: "list"
                                // 			}
                                // 		}
                                // 	});
                                // 	combo.setStore(store);
                                //
                                // 	store.on('endupdate', function() {
                                // 		if(!store.getAt(0)) {
                                // 			Ext.toast({
                                //          html: "没有方案可供选择!",
                                //          width: 200,
                                //          align: 't'
                                //       });
                                // 			return;
                                // 		};
                                // 		if(!combo.getValue()) {
                                // 			combo.setValue(store.getAt(0).get('proCd'))
                                // 		}
                                // 	})
                                // },
                                change: "wanrProjectChange"
                            }
                        },
                        {
                            fieldLabel: "应急事件",
                            bind: "{curList.evenNm}"
                        },
                        {
                            fieldLabel: "污染物类型",
                            bind: "{curList.daType}"
                        },
                        {
                            fieldLabel: "物质初始浓度",
                            // disabled: false,
                            value: '0.01mg/L'
                        },
                        {
                            fieldLabel: "发生河段",
                            reference: 'riverCd',
                            bind: "{rnm}"
                        },
                        {
                            fieldLabel: "发生地点",
                            bind: "{curList.loc}"
                        },
                        {
                            fieldLabel: "参考断面",
                            bind: "{curList.loc}"
                        },
                        {
                            fieldLabel: "上断面距离",
                            bind: "{curList.lenUp}km"
                        },
                        {
                            fieldLabel: "污染发生时间",
                            bind: "{curList.tm}"
                        },
                        {
                            fieldLabel: "污染量",
                            bind: "{curList.da}kg"
                        },
                        {
                            fieldLabel: "持续时间",
                            bind: "{curList.dur}h"
                        },
                        {
                            fieldLabel: "起始时间",
                            bind: "{curList.bgDt}"
                        },
                        {
                            fieldLabel: "终止时间",
                            bind: "{curList.edDt}"
                        },
                        {
                            fieldLabel: "时间尺度",
                            value: "小时"
                        },
                        {
                            fieldLabel: "预热期",
                            bind: "{curList.forTime}h"
                        }
                    ],
                    tbar: [
                        "->",
                        {
                            xtype: "button",
                            text: "模型参数设置",
                            iconCls: "x-fa fa-gear",
                            handler: "onParamSetClick"
                        }
                    ]
                },
                {
                    xtype: "panel",
                    layout: "fit",
                    flex: 1,
                    // html: '<img src="resources/images/demo/newPlan_topology.png" width="100%" height="100%" />',
                    listeners: {
                        added: function(me) {
                            var _that = this;
                            if (config.RIVER === "02") {
                                me.setHtml('<img src="resources/images/demo/newPlan_topology.png" width="100%" height="100%" />');
                            } else {
                                me.setHtml('<img src="resources/images/demo/newPlan_topology_yh.png" width="100%" height="100%" />');
                            }
                        }
                    }
                }
            ]
        },
        //第二部边界
        {
            xtype: "panel",
            flex: 1,
            layout: {
                type: "vbox",
                align: "stretch"
            },
            items: [{
                    xtype: "panel",
                    height: 55,
                    margin: "0 0 10 0",
                    padding: "10 10 10 10",
                    cls: "bg-gray",
                    layout: "column",
                    bodyStyle: {
                        background: "#f6f6f6"
                    },
                    items: [{
                            xtype: "panel",
                            width: 250,
                            bodyStyle: {
                                background: "#f6f6f6"
                            },
                            items: [{
                                xtype: "combobox",
                                fieldLabel: "选择断面",
                                labelWidth: 70,
                                displayField: "label",
                                valueField: "value",
                                reference: "bjtjSurfaceType",
                                listeners: {
                                    afterrender: "bjtjSurfaceTypeAdded",
                                    change: "bjtjSurfaceTypeChange"
                                }
                            }]
                        },
                        {
                            xtype: "panel",
                            style: {
                                float: "right"
                            },
                            defaults: {
                                margin: "0 5 0 0"
                            },
                            items: [{
                                    xtype: "button",
                                    iconCls: "x-fa fa-save",
                                    text: "下载模板",
                                    handler: "bjtjDownload"
                                },
                                {
                                    xtype: "form",
                                    reference: 'uploadDatatwo',
                                    style: {
                                        float: "right"
                                    },
                                    items: [{
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "proCd",
                                            bind: "{curList.proCd}"
                                        },
                                        {
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "stcd",
                                            bind: "{stcd}"
                                        },
                                        {
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "rcd",
                                            bind: "{curList.rcd}"
                                        },
                                        {
                                            xtype: "filefield",
                                            msgTarget: "side",
                                            allowBlank: false,
                                            width: 100,
                                            name: 'fileuploadfield',
                                            hideLabel: true,
                                            buttonOnly: true,
                                            anchor: "100%",
                                            buttonText: "导入数据",
                                            listeners: {
                                                change: 'uploadDatatwo'
                                            }
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    xtype: "panel",
                    title: "南丰流量数据",
                    reference: "bjtjPanel",
                    flex: 1,
                    border: true,
                    layout: {
                        type: "hbox",
                        pack: "start",
                        align: "stretch"
                    },
                    items: [{
                            xtype: "baseGridPanel",
                            width: 300,
                            reference: "llsjGrid",
                            itemId: "llsjGrid",
                            listeners: {
                                validateedit: 'llsjGridEdit'
                            },
                            style: "border-right:1px solid #35BAF6",
                            columns: [{
                                    text: "时间",
                                    dataIndex: "tm",
                                    flex: 1.2
                                },
                                {
                                    text: "流量（m³/s）",
                                    dataIndex: "z",
                                    flex: 1,
                                    editor: {
                                        field: {
                                            xtype: 'numberfield',
                                            allowBlank: false
                                        }
                                    },
                                }
                            ],
                            plugins: {
                                ptype: 'cellediting',
                                clicksToEdit: 1
                            },
                        },
                        {
                            xtype: "panel",
                            flex: 1,
                            highchart: null,
                            reference: "newPlanChart1",
                            html: '<div id="newPlanChart1" style="margin: 5"></div>',
                            listeners: {
                                afterRender: function(dom) {
                                    var me = this;
                                    var domId = document.getElementById('newPlanChart1');
                                    me.highchart = new Highcharts.Chart({
                                        chart: {
                                            renderTo: "newPlanChart1",
                                            type: 'spline'
                                        },
                                        title: {
                                            text: ""
                                        },
                                        xAxis: {
                                            categories: [0]
                                        },
                                        yAxis: {
                                            min: 0,
                                            title: {
                                                text: ""
                                            },
                                        },
                                        legend: {
                                            align: 'center',
                                            verticalAlign: 'top',
                                        },
                                        tooltip: {
                                            valueSuffix: ""
                                        },
                                        series: [{
                                            name: "",
                                            data: [0]
                                        }]
                                    });
                                },
                                resize: function(me, width, height) {
                                    this.highchart.setSize(width, height);
                                }
                            }
                        }
                    ]
                }
            ]
        },
        //第三步边界
        {
            xtype: "panel",
            flex: 1,
            layout: {
                type: "vbox",
                align: "stretch"
            },
            items: [
                //选择区域
                {
                    xtype: "panel",
                    height: 50,
                    cls: "dashboard-main-chart shadow",
                    // border: true,
                    layout: "column",
                    margin: "0 0 10 0",
                    bodyStyle: {
                        background: "#f6f6f6"
                    },
                    dockedItems: [{
                        xtype: "toolbar",
                        dock: "top",
                        style: {
                            background: "#f6f6f6"
                        },
                        bodyStyle: {
                            background: "#f6f6f6"
                        },
                        items: [{
                                xtype: "panel",
                                width: 90,
                                html: "水质调度目标:",
                                bodyStyle: {
                                    background: "#f6f6f6"
                                },
                            },
                            {
                                xtype: "button",
                                text: "详细设置",
                                handler: "wqObjectiveHandler"
                            },
                            {
                                xtype: "combobox",
                                fieldLabel: "水库选择",
                                reference: "shuikuCombobox",
                                labelAlign: 'right',
                                valueField: "resCd",
                                displayField: "resNm",
                                listeners: {
                                    change: "shuikuComboboxChange"
                                }
                            },
                            "->",
                            {
                                xtype: "button",
                                iconCls: "x-fa fa-save",
                                text: "保存",
                                handler: 'sktjSave'
                            }
                        ]
                    }]
                },
                {
                    xtype: "panel",
                    cls: "dashboard-main-chart shadow",
                    height: 50,
                    // border: true,
                    margin: "0 0 10 0",
                    layout: "column",
                    defaults: {
                        margin: "8 3 5 3"
                            // cls: 'bg-gray',
                    },
                    bodyStyle: {
                        background: "#f6f6f6"
                    },
                    items: [{
                            xtype: "textfield",
                            fieldLabel: "初始水位(m)",
                            width: '180',
                            margin: "8 10 5 5",
                            reference: "shuikuCssw",
                            bind: {
                                value: "{shuikuList.z}"
                            }
                        },
                        {
                            xtype: "fieldcontainer",
                            width: 360,
                            fieldLabel: "原计划下泄",
                            labelWidth: 75,
                            layout: 'column',
                            items: [{
                                    xtype: 'button',
                                    width: 55,
                                    text: '读取',
                                    handler: 'fetchOriginalPlan'
                                },
                                {
                                    xtype: "button",
                                    width: 120,
                                    style: { marginLeft: '8px' },
                                    iconCls: "x-fa fa-save",
                                    text: "下载模板",
                                    handler: "bjtjDownload31"
                                },
                                {
                                    xtype: 'form',
                                    width: 90,
                                    layout: 'anchor',
                                    bodyStyle: {
                                        background: "#f6f6f6"
                                    },
                                    items: [{
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "proCd",
                                            bind: "{curList.proCd}"
                                        },
                                        {
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "resCd",
                                            bind: "{shuikuList.resCd}"
                                        },
                                        {
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "stcd",
                                            bind: "{stcd}"
                                        },
                                        {
                                            xtype: "textfield",
                                            hidden: true,
                                            name: "rcd",
                                            bind: "{curList.rcd}"
                                        },
                                        // {
                                        //     xtype: "textfield",
                                        //     hidden: true,
                                        //     name: "vtype",
                                        //     value: 1,
                                        // },
                                        {
                                            xtype: "filefield",
                                            msgTarget: "side",
                                            // allowBlank: false,
                                            anchor: "100%",
                                            buttonOnly: true,
                                            name: 'fileuploadfield',
                                            hideLabel: true,
                                            buttonText: "导入数据",
                                            bodyStyle: {
                                                background: "#f6f6f6"
                                            },
                                            listeners: {
                                                change: 'oldFlowUpdateFile'
                                            }
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            xtype: "panel",
                            layout: "column",
                            width: 370,
                            bodyStyle: {
                                background: "#f6f6f6"
                            },
                            items: [{
                                xtype: "fieldcontainer",
                                columnWidth: 1,
                                fieldLabel: "加大下泄方式",
                                labelWidth: 90,
                                bodyStyle: {
                                    background: "#f6f6f6"
                                },
                                layout: 'column',
                                items: [{
                                        xtype: 'button',
                                        width: 55,
                                        text: '固定',
                                        handler: 'addFixedFlow'
                                    },
                                    {
                                        xtype: "button",
                                        width: 120,
                                        style: { marginLeft: '8px' },
                                        iconCls: "x-fa fa-save",
                                        text: "下载模板",
                                        handler: "bjtjDownload31"
                                    },
                                    {
                                        xtype: 'form',
                                        width: 90,
                                        layout: 'anchor',
                                        bodyStyle: {
                                            background: "#f6f6f6"
                                        },
                                        items: [{
                                                xtype: "textfield",
                                                hidden: true,
                                                name: "proCd",
                                                bind: "{curList.proCd}"
                                            },
                                            {
                                                xtype: "textfield",
                                                hidden: true,
                                                name: "stcd",
                                                bind: "{stcd}"
                                            },
                                            {
                                                xtype: "textfield",
                                                hidden: true,
                                                name: "rcd",
                                                bind: "{curList.rcd}"
                                            },
                                            // {
                                            //     xtype: "textfield",
                                            //     hidden: true,
                                            //     name: "vtype",
                                            //     value: 2,
                                            // },
                                            {
                                                xtype: "filefield",
                                                msgTarget: "side",
                                                // allowBlank: false,
                                                anchor: "100%",
                                                buttonOnly: true,
                                                hideLabel: true,
                                                name: 'fileuploadfield',
                                                buttonText: "导入数据",
                                                bodyStyle: {
                                                    background: "#f6f6f6"
                                                },
                                                listeners: {
                                                    change: "oldFlowUpdateFile"
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }]
                        }
                        // {
                        //     xtype: "datefield",
                        //     fieldLabel: "开始加大下泄",
                        //     labelWidth: 90,
                        //     columnWidth: 0.33,
                        //     editable: false,
                        //     hidden: true,
                        //     reference: "shuikuStartTm",
                        //     format: 'Y-m-d H:i:s',
                        //     listeners: {
                        //         change: 'sktjStartTimeChange'
                        //     }
                        // },
                        // {
                        //     xtype: "datefield",
                        //     labelWidth: 90,
                        //     fieldLabel: "结束加大下泄",
                        //     columnWidth: 0.33,
                        //     editable: false,
                        //     hidden: true,
                        //     reference: "shuikuEndTm",
                        //     format: 'Y-m-d H:i:s',
                        //     // bind: {
                        //     //   value: "{shuikuList.endtime}"
                        //     // },
                        //     listeners: {
                        //         change: 'sktjEndTiemChange'
                        //     }
                        // }
                    ]
                },

                {
                    xtype: "panel",
                    flex: 1,
                    border: true,
                    layout: {
                        type: "hbox",
                        align: "stretch"
                    },
                    items: [{
                            xtype: "baseGridPanel",
                            width: 500,
                            reference: "ddsDrPptnGrid",
                            height: "100%",
                            style: {
                                borderRight: "1px solid #35BAF6"
                            },
                            bind: {
                                title: "{shuikuList.resNm}" + "下泄流量过程表"
                            },
                            columns: [{
                                    text: "时间",
                                    dataIndex: "tm",
                                    flex: 1
                                },
                                {
                                    text: "原计划流量（m³/s)",
                                    flex: 1,
                                    dataIndex: "otq",
                                    editor: {
                                        field: {
                                            xtype: 'numberfield',
                                            allowBlank: false
                                        }
                                    },

                                },
                                {
                                    text: "加大流量（m³/s)",
                                    flex: 1,
                                    dataIndex: "exq",
                                    editor: {
                                        field: {
                                            xtype: 'numberfield',
                                            allowBlank: false
                                        }
                                    },
                                }
                            ],
                            listeners: {
                                validateedit: 'ddsDrPptnGridEdit'
                            },
                            plugins: {
                                ptype: "cellediting",
                                clicksToEdit: 1
                            }
                        },
                        {
                            xtype: "panel",
                            bind: {
                                title: "{shuikuList.resNm}" + "下泄流量过程曲线图"
                            },
                            flex: 1,
                            highchart: null,
                            reference: "newPlanChart2",
                            html: '<div id="newPlanChart2" style="height: 95%, width: 90%"></div>',
                            listeners: {
                                afterRender: function(dom) {
                                    var me = this;
                                    var domId = document.getElementById('newPlanChart2');
                                    me.highchart = new Highcharts.Chart({
                                        chart: {
                                            type: 'spline',
                                            renderTo: domId
                                        },
                                        title: {
                                            text: ""
                                        },
                                        legend: {
                                            align: 'center',
                                            verticalAlign: 'top',
                                        },
                                        xAxis: {
                                            categories: [0],
                                            labels: {
                                                step: 10,
                                            }
                                        },
                                        yAxis: {
                                            title: {
                                                text: "流量(m³/s)"
                                            }
                                        },
                                        tooltip: {
                                            valueSuffix: ""
                                        },
                                        series: [{
                                                name: "原计划流量",
                                                data: [0]
                                            },
                                            {
                                                name: "加大流量",
                                                data: [0]
                                            }
                                        ]
                                    });
                                },
                                resize: function(me, width, height) {
                                    if (this.highchart) {
                                        this.highchart.setSize(width, height - 45);
                                    }
                                }
                            }
                        }
                    ]
                }
            ]
        },

        /**
         * 第四步 调度结果
         */
        {
            xtype: "panel",
            flex: 1,
            layout: {
                type: "hbox",
                align: "stretch"
            },
            items: [{
                    xtype: "treepanel",
                    title: "断面选择",
                    reference: "resultTreePanel",
                    width: 250,
                    border: true,
                    rootVisible: false,
                    useArrows: true,
                    bind: {
                        store: {
                            root: {
                                expended: true,
                                children: "{ddjgData.secTree}"
                            }
                        }
                    },
                    viewConfig: {
                        plugins: {
                            ptype: "treeviewdragdrop",
                            containerScroll: true
                        }
                    },
                    listeners: {
                        selectionchange: "resultTreeChange"
                    }
                },
                {
                    xtype: "panel",
                    title: "结果数据",
                    reference: "jgsjPanel",
                    flex: 1,
                    border: true,
                    margin: "0 0 0 8",
                    layout: {
                        type: "hbox",
                        align: "stretch"
                    },
                    items: [{
                            xtype: "baseGridPanel",
                            width: 350,
                            reference: "ddjgGrid",
                            style: {
                                borderRight: '1px solid #35baf6'
                            },
                            tbar: [{
                                xtype: "segmentedbutton",
                                listeners: {
                                    change: "ddjgSelectedTbarChange"
                                },
                                items: [{
                                        text: "水位",
                                        value: 'Z',
                                        reference: "ddjgTbar-Z"
                                    },
                                    {
                                        text: "入库流量",
                                        value: 'INQ',
                                        reference: "ddjgTbar-INQ"
                                    },
                                    {
                                        text: "出库流量",
                                        value: 'OTQ',
                                        reference: "ddjgTbar-OTQ"
                                    },
                                    {
                                        text: "流量",
                                        value: 'Q',
                                        reference: "ddjgTbar-Q"
                                    },
                                    {
                                        text: "水质",
                                        value: 'BOPL',
                                        reference: "ddjgTbar-BOPL"
                                    }
                                ]
                            }],
                            columns: [{
                                    text: "时间",
                                    dataIndex: "tm",
                                    width: 120
                                },
                                {
                                    text: "调度方案",
                                    dataIndex: "realValue",
                                    width: 110
                                },
                                {
                                    text: "原计划",
                                    width: 103,
                                    dataIndex: "planValue"
                                }
                            ]
                        },
                        {
                            xtype: "panel",
                            flex: 1,
                            highchart: null,
                            reference: "newPlanChart3",
                            html: '<div id="newPlanChart3" style="height: 95%"></div>',
                            listeners: {
                                afterRender: function(dom) {
                                    var me = this;
                                    var domId = document.getElementById('newPlanChart3');
                                    me.highchart = new Highcharts.Chart({
                                        chart: {
                                            type: 'spline',
                                            renderTo: domId
                                        },
                                        title: {
                                            text: ""
                                        },
                                        xAxis: {
                                            categories: [0]
                                        },
                                        legend: {
                                            align: 'center',
                                            verticalAlign: 'top',
                                        },
                                        yAxis: {
                                            title: {
                                                text: ""
                                            },
                                        },
                                        tooltip: {
                                            valueSuffix: ""
                                        },
                                        series: [{
                                                name: "调度方案",
                                                data: [0]
                                            },
                                            {
                                                name: "原计划",
                                                data: [0]
                                            }
                                        ]
                                    });
                                },
                                resize: function(me, width, height) {
                                    this.highchart.setSize(width, height);
                                }
                            }
                        }
                    ]
                }
            ]
        },
        {
            xtype: "panel",
            title: "动画演进",
            layout: "fit",
            flex: 1,
            listeners: {
                added: function(me, item, rendered, eOpts) {
                    // console.log('发生render');
                    me.setHtml('<iframe id="supermapDemo" style="border:0px;height:100%;" src="resources/arcgis_map.html" class="mapInfo" ></iframe>');
                }
            }
        }
    ]
});

//模型参数设置
Ext.define("Admin.view.emergencyDispatch.ModelForm", {
    extend: "Admin.common.form.BaseFormPanel",
    xtype: "modelForm",
    alias: "modelForm",
    bodyPadding: 10,
    layout: "anchor",
    resizable: false,
    viewmodel: {
        type: "newPlan"
    },
    defaults: {
        anchor: "100%",
        labelWidth: 60,
        labelAlign: "right"
    },
    items: [{
            xtype: "panel",
            defaultType: "numberfield",
            margin: "0 0 10 0",
            defaults: {
                labelWidth: 100,
                labelAlign: "right",
            },

            items: [{
                fieldLabel: "降解系数",
                name: "k",
                allowBlank: false,
                minValue: 0,
                maxValue: 1,
                decimalPrecision: 5,
                maxLength: 7,
                value: 0.00001,
                blankText: "降解系数不能为空!",
                margin: "0 10 0 0",

            }]
        },
        {
            xtype: "panel",
            defaultType: "numberfield",
            margin: "0 0 10 0",
            defaults: {
                labelWidth: 100,
                labelAlign: "right",
            },
            items: [{
                fieldLabel: "扩散系数",
                name: "a",
                minValue: 0,
                maxValue: 1,
                decimalPrecision: 5,
                maxLength: 7,
                allowBlank: false,
                value: 0.00001,
                blankText: "扩散系数不能为空!",
                margin: "0 10 0 0"
            }]
        },
        {
            xtype: "panel",
            defaultType: "numberfield",
            margin: "0 0 10 0",
            defaults: {
                labelWidth: 100,
                labelAlign: "right",
            },
            items: [{
                fieldLabel: "河道糙率",
                name: "r",
                minValue: 0,
                maxValue: 1,
                decimalPrecision: 5,
                maxLength: 7,
                allowBlank: false,
                value: 0.00001,
                blankText: "河道糙率不能为空!",
                margin: "0 10 0 0"
            }]
        }
    ]
});

Ext.define("Admin.view.emergencyDispatch.NewPlanInfo", {
    extend: "Admin.common.form.BaseFormPanel",
    xtype: "newPlanInfo",
    alias: "newPlanInfo",
    requires: [
        "Admin.view.emergencyDispatch.NewPlanViewModel"
    ],
    layout: "form",

    defaults: {
        labelWidth: 100,
        labelAlign: 'right',
        disabled: true,
        cls: "newPlanInfoText",
    },

    defaultType: "textfield",
    items: [{
            fieldLabel: "方案名称",
            name: 'proNm',
        },
        {
            fieldLabel: "应急事件",
            name: 'evenNm',
        },
        {
            fieldLabel: "污染物类型",
            name: 'daType',
        },
        {
            fieldLabel: "物质初始浓度",
            value: 0.01
        },
        {
            fieldLabel: "发生河段",
            name: 'rnm',
        },
        {
            fieldLabel: "发生地点",
            name: 'loc',
        },
        {
            fieldLabel: "参考断面",
            name: 'loc1',
        },
        {
            fieldLabel: "上断面距离",
            name: 'lenUp',
        },
        {
            fieldLabel: "污染发生时间",
            name: 'tm',
        },
        {
            fieldLabel: "污染量",
            name: 'da',
        },
        {
            fieldLabel: "持续时间",
            name: 'dur',
        },
        {
            fieldLabel: "起始时间",
            name: 'bgDt'
        },
        {
            fieldLabel: "终止时间",
            name: 'edDt',
        },
        {
            fieldLabel: "时间尺度",
            value: "小时"
        },
        {
            fieldLabel: "预热期",
            name: 'forTime',
        }
    ]

});

/**
 * 水库调节-水质调度目标-详细设置的弹出框内容
 */
Ext.define("Admin.view.emergencyDispatch.WqObjective", {
    extend: "Ext.panel.Panel",
    xtype: "wqObjective",
    alias: "widget.wqObjective",
    viewModel: {
        type: "newPlan"
    },
    layers: "fit",
    items: [{
        xtype: "baseGridPanel",
        cls: "grid-window-title",
        margin: "5 5 5 5",
        reference: "wqObjectiveGrid",
        border: true,
        listeners: {
            edit: 'sktjObjectiveSet'
        },
        plugins: {
            ptype: "cellediting",
            clicksToEdit: 2
        },
        columns: [{
                text: "类型",
                dataIndex: "stype",
                flex: 1
            },
            {
                text: "名称",
                flex: 1,
                dataIndex: "secnm"
            },
            {
                text: "水质浓度标准(mg/L)",
                flex: 1,
                dataIndex: "concst",
                editor: {
                    allowBlank: true
                }
            }
        ],
        bind: {
            store: {
                data: "{sktjData.listconsec}"
            }
        }
    }]
});